What would be the most efficient way to determine for a given object o and link lnk (an out-link or in-link) if the if the object othero at the other end of the link is in the same DOORS project as the given object o? I want to avoid opening the module with the other object, if possible. Maybe something like below? (Seems to work.)
Object o=current, othero
if (null o) {print "no object"; halt}
string o_projUID=uniqueID(getParentProject(module(o)))
Link lnk
ModName_ otherModRef
int lnkCnt=0
print "ID " o."Absolute Number" ":\n"
for lnk in o->"*" do // for lnk in o<-"*" do
{
lnkCnt++
otherModRef=target(lnk) // otherModRef=source(lnk)
if ( uniqueID(getParentProject(otherModRef)) == o_projUID)
{
print "[" lnkCnt "] Link exists with object in SAME project!\n"
}
else
{
print "[" lnkCnt "] Link exists with object NOT in same project!\n"
}
}
strathglass - Wed Apr 05 10:32:26 EDT 2017 |
Re: Efficient Way to See if Linked Object in Same Project? Do not have access to DOORS right now, but getParentProject works also on ModName_s. With that function you would get two Project type values and compare those for equality. |
Re: Efficient Way to See if Linked Object in Same Project? PekkaMakinen - Wed Apr 05 13:48:03 EDT 2017 Do not have access to DOORS right now, but getParentProject works also on ModName_s. With that function you would get two Project type values and compare those for equality. Yes, that is what I am doing for the target object: "otherModRef" is a ModName_ variable (don't need it for current object though).
So I guess this all seems to work OK, and seems pretty efficient...I can only process further the objects in the same project and open the other module as required.
Thanks. |
Re: Efficient Way to See if Linked Object in Same Project? strathglass - Wed Apr 05 14:28:34 EDT 2017 Yes, that is what I am doing for the target object: "otherModRef" is a ModName_ variable (don't need it for current object though).
So I guess this all seems to work OK, and seems pretty efficient...I can only process further the objects in the same project and open the other module as required.
Thanks. But you do not have to mess around with uniqueIDs
|
Re: Efficient Way to See if Linked Object in Same Project? PekkaMakinen - Thu Apr 06 01:44:43 EDT 2017 But you do not have to mess around with uniqueIDs
You're right, thanks. I think I had that because at some point I was dealing with only a project name, but clearly here I can just compare Projects! |